<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link rel="stylesheet" type="text/css" href="./css/api.css" />
    <link rel="stylesheet" type="text/css" href="./css/aui.css" />
    <link rel="stylesheet" type="text/css" href="./css/iconfont.css" />
    <style type="text/css">
        .header {
            background-color: #ffffff;
            /*border-bottom: solid 1px #F0F0F0;*/
            color: #000;
        }
        .aui-bar.aui-bar-nav.header.noClass {
            background: #f3f3f3 !important;
        }
        .aui-bar.aui-bar-nav.header.blueClass{
            color: #fff !important;
            background: #1a66ff !important;
        }
        .aui-bar.aui-bar-nav.header.blueClass i{
            color: #fff !important;
        }

        /* .header {
            border: none;
            background-size: 100% 1px;
            background-repeat: no-repeat;
            background-position: bottom;
            background-image: linear-gradient(0, #eeeeee, #eeeeee 50%, transparent 50%);
            background-image: -webkit-linear-gradient(90deg, #eeeeee, #eeeeee 50%, transparent 50%);
        } */

        .iconfont {
            font-size: 1rem;
        }

        .aui-btn.aui-pull-right.hidden,
        .hidden {
            display: none;
        }
        .aui-pull-right i{
            color: #333;
        }

        .aui-bar-nav .aui-btn.hidden {
            display: none;
        }

        .aui-searchbar-input {
            margin-top: 0.4rem;
            border: solid 1px #ddd;
            background-color: #ddd;
            border-radius: 10px;
            margin-right: 2rem;
        }
    </style>
</head>

<body>
    <header class="aui-bar aui-bar-nav header" id="aui-header">
        <a id="aui-left-arrow" class="aui-btn aui-pull-left" tapmode onclick="closeWin()">
            <i class="icon iconfont icon-fanhui" style="color:#000;"></i>
        </a>
        <div id="frametitle" class="aui-title"></div>
        <div id="search_product" class="aui-searchbar-input aui-border-radius hidden">
            <input type="search" onclick="open_search_bar()" placeholder="请输入商品名称" readonly="readonly" id="search-input">
        </div>
        <div id="search_order" class="aui-searchbar-input aui-border-radius hidden">
            <input type="search" onclick="open_search_bar()" placeholder="商品名称|订单号|手机号|物流单" readonly="readonly" id="search-input">
        </div>
        <a class="aui-btn aui-pull-right hidden" id="right_content" style="color:#ffc107;font-size: 0.6rem;" tapmode onclick="do_open_bx()">
            处理反馈
        </a>
        <a class="aui-btn aui-pull-right hidden" id="right_balance" style="color:#ffc107;font-size: 0.6rem;" tapmode onclick="do_open_balancedetail()">
            账户明细
        </a>
        <a class="aui-btn aui-pull-right hidden" id="right_point" style="color:#ffc107;font-size: 0.6rem;" tapmode onclick="do_open_pointdetail()">
            当前积分
        </a>
        <a class="aui-btn aui-pull-right hidden" id="right_share" style="color:#ffc107;font-size: 0.6rem;" tapmode onclick="do_open_share()">
            <i class="icon iconfont icon-fenxiang"></i>
        </a>
        <a class="aui-btn aui-pull-right hidden" id="right_save" style="color:#ffc107;font-size: 0.7rem;" tapmode onclick="do_open_save()">
            保存
        </a>
        <a class="aui-btn aui-pull-right hidden" id="right_phrase" style="color:#ffc107;font-size: 0.7rem;" tapmode onclick="do_open_phrase()">
            我要发帖
        </a>
        <a class="aui-btn aui-pull-right hidden" id="right_bx_process" style="color:#ffc107;font-size: 0.7rem;" tapmode onclick="do_open_bx_process_list()">
            处理记录
        </a>
        <!-- 右上角筛选按钮 -->
        <a class="aui-btn aui-pull-right hidden" id="right_saixuan" style="color:#333;font-size: 1rem;" tapmode onclick="do_open_saixuan()">
            <i class="icon iconfont icon-shaixuan1" style="font-size: 1.2rem; margin-right: 5px;"></i>
        </a>
        <!-- 右上角搜索按钮 -->
        <a class="aui-btn aui-pull-right hidden" id="right_search" style="color:#333;font-size: 0.7rem;" tapmode onclick="do_open_search()">
            <i class="icon iconfont icon-sousuo" style="margin-right: 5px;"></i>
        </a>
        <!-- 右上角编辑按钮 -->
        <a class="aui-btn aui-pull-right hidden" id="right_edit" style="color:#333;font-size: 0.7rem;" tapmode onclick="do_open_edit()">
            <i class="icon iconfont icon-bianji" style="margin-right: 5px;"></i>
        </a>
        <!-- 右上角分类 -->
        <a class="aui-btn aui-pull-right hidden" id="right_fenlei" style="color:#333;font-size: 0.8rem; text-shadow: 0px 0px 0px #333;" tapmode onclick="do_open_fenlei()">
            <i class="icon iconfont icon-fenlei"></i>
        </a>
        

    </header>
</body>
<script type="text/javascript" src="./script/api.js "></script>
<script type="text/javascript">
    var searchtype = 0;
    var headerbg=false;
    window._onclose = null;
    window.url = null;
    window.closeWin = function() {
        if (window.url) {
            return;
        }
        if (window._onclose) {
            api.execScript({
                name: api.winName,
                frameName: "main",
                script: window._onclose
            });
        } else {
            api.closeWin();
        }
    };
    window.do_open_bx = function() {
        api.sendEvent({
            name: 'do_open_bx_list'
        });
    }
    window.do_open_balancedetail = function() {
        api.sendEvent({
            name: 'do_open_balancedetail'
        });
    }
    window.do_open_pointdetail = function() {
        api.sendEvent({
            name: 'do_open_pointdetail'
        });
    }
    window.do_open_share = function() {
        api.sendEvent({
            name: 'do_open_share'
        });
    }
    window.do_open_save = function() {
        api.sendEvent({
            name: 'do_open_save'
        });
    }
    window.do_open_phrase = function() {
        api.sendEvent({
            name: 'do_open_phrasepost'
        });
    }
    window.do_open_search = function() {
        api.sendEvent({
            name: 'do_open_search'
        });
    }
    window.do_open_saixuan = function() {
        api.sendEvent({
            name: 'do_open_saixuan'
        });
    }
    window.do_open_fenlei = function() {
        api.sendEvent({
            name: 'do_open_fenlei'
        });
    }
    
    window.do_open_edit = function() {
        api.sendEvent({
            name: 'do_open_edit'
        });
    }
    
    window.do_open_bx_process_list = function() {
        api.sendEvent({
            name: 'do_open_bx_process_list'
        });
    }
    window.open_search_bar = function() {
        var delay = 0;
        if (api.systemType != 'ios') {
            delay = 100;
        }
        api.openTabLayout({
            hideNavigationBar: true,
            hideTabBar: true,
            useWKWebView: true,
            name: 'searchbar_frm',
            url: './html/searchbar_frm.html',
            delay: delay,
            slidBackEnabled: false,
            vScrollBarEnabled: false,
            pageParam: {
                searchtype: searchtype,
            },
            rect: {
                x: 0,
                y: 0,
                w: 'auto',
                h: 'auto',
            },
            animation: {
                type: 'movein',
                subType: 'from_bottom'
            }
        });
    }
    apiready = function() {
        var header = $api.byId('aui-header');
        $api.fixStatusBar(header);
        var headerH = $api.offset(header).h;
        var frameH = api.winHeight;
        var url = api.pageParam.url;
        headerbg=api.pageParam.headerbg||false;
        if (headerbg==1) {
            $api.addCls(header, 'noClass');
        }else if(headerbg==2){
            $api.addCls(header, 'blueClass');
        }
        if (url == 'login_frm.html') {
            window.url = url;
            $api.toggleCls($api.byId('aui-left-arrow'), 'hidden');
        }
        var title = api.pageParam.title;
        if (url && url.length > 0 && url[0] != '.' && url[0] != '/' && url[0] != '\\') {
            if (url.indexOf('http://') < 0 && url.indexOf('https://') < 0) {
                url = 'html/' + url;
            }
        }
        searchtype = api.pageParam.searchtype || 0; //1-商品分类 2-商家详情 3-积分商城 4-拼团 5-抢购 6-拼团抢购
        var pageParam = {
            header_h: headerH,
        }
        Object.keys(api.pageParam).forEach(function(key) {
            if (key != 'title' && key != 'url') {
                pageParam[key] = api.pageParam[key];
            }
        });

        var type = api.pageParam.searchtype || 0; //1-物业收费 2-购买商品 3-商品分类 4-购物车商品 5-选择收货地址 6-拼团成功，准备购买 7-订单支付完成 8-微信登录 9-QQ登录 10-微博登录 11-报修处理进度 12-账户余额 13-积分商城 14-购买服务 15-推荐商家 16-普通商品详情 17-积分商品详情 18-合伙人商品详情 19-关于我们 20-合伙人商城 21-个人中心 22-拼团抢购 23-销量排序 24-即将过期优惠券 25-报修处理记录 29-营销活动
        if (type > 0) {
            pageParam.type = type;
        }
        if (type == 7) {
            $api.toggleCls($api.byId('frametitle'), 'hidden');
            $api.toggleCls($api.byId('search_order'), 'hidden');
        }
        if (type == 11) {
            $api.toggleCls($api.byId('right_content'), 'hidden');
        }
        if (type == 12) {
            $api.toggleCls($api.byId('right_balance'), 'hidden');
        }
        if (type == 13 || type == 20) {
            $api.toggleCls($api.byId('right_point'), 'hidden');
        }
        if (type == 19) {
            $api.toggleCls($api.byId('right_share'), 'hidden');
        }
        if (type == 21) {
            $api.toggleCls($api.byId('right_save'), 'hidden');
        }
        if (type == 25) {
            $api.toggleCls($api.byId('right_bx_process'), 'hidden');
        }
        // 26订单列表
        if (type == 26) {
            $api.toggleCls($api.byId('right_search'), 'hidden');
            $api.toggleCls($api.byId('right_saixuan'), 'hidden');
            
        }
        // 27商品管理列表
        if (type == 27) {
            $api.toggleCls($api.byId('right_search'), 'hidden');
            $api.toggleCls($api.byId('right_fenlei'), 'hidden');
            
        }
        // 28交易流水 29营销活动 31优惠卡券
        if (type == 28||type == 29||type==31) {
            $api.toggleCls($api.byId('right_saixuan'), 'hidden');
        }
         // 30 商品详情
         if (type == 30) {
            $api.toggleCls($api.byId('right_edit'), 'hidden');
        }
        // else if (searchtype > 0) {
        //     $api.toggleCls($api.byId('frametitle'), 'hidden');
        //     // $api.toggleCls($api.byId('search_product'), 'hidden');
        // }
        var bounces = api.pageParam.bounces || false;
        window._onclose = api.pageParam.onclose;
        api.openFrame({
            name: "main",
            url: url,
            bounces: bounces,
            pageParam: pageParam,
            rect: {
                x: 0,
                y: headerH,
                w: 'auto',
                h: 'auto',
                marginBottom: 0
            }
        });
        $api.dom(header, '#frametitle').innerText = title;
        api.addEventListener({
            name: 'keyback'
        }, function(ret, err) {
            if (ret) {
                window.closeWin();
            }
        });
        api.addEventListener({
            name: 'do_show_phrasebbs'
        }, function(ret, err) {
            if (ret) {
                $api.removeCls($api.byId('right_phrase'), 'hidden');
            }
        });
        api.addEventListener({
            name: 'do_hide_phrasebbs'
        }, function(ret, err) {
            if (ret) {
                $api.addCls($api.byId('right_phrase'), 'hidden');
            }
        });
    };
</script>

</html>
